#include <bits/stdc++.h>
using namespace std;
int main()
{
	int n,m,record[3100],out[3000];
	int i,result,t;
	bool sign=true;
	cin>>n>>m;
	if (m>=0 && n>=0 && n>=m && n<=3000)
	{
		for (i=0;i<n;i++)
		{
			cin>>record[i];
			if (record[i]<1 && record[i]>100)
			{
				sign = false;
				break;
			}
		}	
		if (sign)
		{
			for (i=0;(i+m-1)!=n;i++)
			{
				out[i] = 0;
				for (t=0;t<m;t++)
				{
					out[i] = out[i] + record[i+t];
				}
			}
			result = out[0];
			for (i=1;(i+m-1)!=n;i++)
			{
				if (out[i]<result) result = out[i];
				else continue;
			}
			cout<<result<<endl;
		}
		else cout<<"Error!"<<endl;
	}
	else cout<<"Error!"<<endl;
	return 0;
}
